<template>
  <div class="mv">
    <div class="mv-hd">
      <div class="mv-video">
        <videoplay :mvUrl="mvUrl" v-if="isend"></videoplay>
      </div>
      <div class="mv-info">
        <div class="mv-info-hd">
          <div class="info-hd-left">
            <span class="title">{{mvInfo.name}}</span>
            <span class="artist small">{{mvInfo.artistName}}</span>
          </div>
          <div class="info-hd-right">
            <span class="small">播放量：{{$util.handleNum(mvInfo.playCount)}}</span>
            <span class="small">发布时间：{{mvInfo.publishTime}}</span>
          </div>
        </div>
        <div v-if="mvInfo.briefDesc" class="mv-info-done small">{{mvInfo.briefDesc}}}</div>
        <div v-else class="mv-info-done small">暂无简介</div>
      </div>
    </div>
    <div class="mv-main">
      <div class="mv-main-comment">
        <comments :comment_params="mv_CommentParams" :type="1"></comments>
      </div>
      <div class="mv-main-resemble">
        <h4>相似mv</h4>
        <mv-list :newMvList="resembleMvList" class="simi"></mv-list>
      </div>
    </div>
  </div>
</template>
<script>
import Videoplay from "@/components/common/Video-play.vue";
import Comments from "@/components/common/Comments.vue";
import MvList from "@/components/common/MvList.vue";
export default {
  components: {
    Videoplay,
    Comments,
    MvList,
  },
  data() {
    return {
      mvUrl: "",
      isend: false,
      mid: "",
      mv_params: {
        id: "",
        r: "",
      },
      mv_CommentParams: {
        id: this.$route.query.id,
        limit: 20,
        offset: 0,
        before: 0,
      },
      resembleMvList: [],
      mvInfo:{}
    };
  },
  async created() {
    const id = this.$route.query.id;
    this.dealId(id)
  },
  computed: {},
  watch: {
    $route: {
      handler(newval) {
        this.dealId(newval.query.id)
      },
    },
    deep: true,
  },
  methods: {
    async getMvUrl(params) {
      const res = await this.$api.getMvUrl(params);
      // console.log(res)
      this.mvUrl = res.data.url;
      this.isend = true;
    },
    async getSimiMv(mid) {
      const res = await this.$api.getSimiMv(mid);
      this.resembleMvList = res.mvs;
      // console.log(res);
    },
    async getDetailMv(mid){
      const res =await this.$api.getDetailMv(mid);
      this.mvInfo=res.data;
      console.log(res)
    },
   async dealId(nevId){
       this.mid = nevId;
        this.mv_params.id = nevId;
        this.mv_CommentParams.id = nevId;
        await this.getMvUrl(this.mv_params);
        await this.getDetailMv(nevId);
        await this.getSimiMv(this.mid);
    }
  },
};
</script>
<style lang="less" scoped>
.mv {
  width: 100%;
  .small {
    font-size: 13px;
    color: #999;
  }
  .witer {
    color: #fff;
  }
  .mv-hd {
    width: 100%;
    height: 810px;
    background-color: #fff;
    // border: 1px solid #ccc;
  }
  .mv-video {
    padding-top: 20px;
  }
  .mv-info {
    width: 1200px;
    height: 104px;
    margin: 0 auto;
    // border: 1px solid #ccc;
    padding: 2px;
    .mv-info-hd {
      // border: 1px solid #ccc;
      display: flex;
      justify-content: space-between;
      padding: 6px 10px 10px;
      height: 64px;
      width: 100%;
      .info-hd-left {
        min-width: 500px;
        height: 100%;
        // padding: 10px;
        line-height: 48px;
        span:nth-child(1) {
          font-size: 24px;
          margin-right: 20px;
        }
      }
      .info-hd-right {
        line-height: 48px;
        span:nth-child(2) {
          margin-left: 30px;
        }
      }
    }
  }
  .mv-main {
    width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
  }
  .mv-main-comment {
    width: 880px;
  }
  .mv-main-resemble {
    width: 300px;
    height: 600px;
    margin-top: 35px;
    padding-left: 20px;
    h4 {
      font-size: 16px;
      color: #333;
      position: relative;
      margin-left: 15px;
    }
    h4::before {
      display: block;
      content: "";
      position: absolute;
      top: 1px;
      left: -10px;
      width: 4px;
      border-radius: 3px;
      height: 20px;
      background-color: #ff641e;
    }
    .simi {
      /deep/.mv-content {
        width: 300px;
        flex-direction: column;
        .mv-imgtop {
          width: 260px;
          height: 130px;
        }
      }
    }
  }
}
</style>
